/**
 * 事件总线
 * 用来解决组件件的通信，减少组件间的耦合
 */
//引入mitt
import mitt, { type Emitter } from "mitt";

type Events = {
    "loading-open": { target: string; text: string } | string | void;
    "loading-close": void;
    "msg-info": { message: string; duration: number } | string;
    "msg-success": { message: string; duration: number } | string;
    "msg-warning": { message: string; duration: number } | string;
    "msg-error": { message: string; duration: number } | string;
    "router-push": string;
    "router-remove": void;
    "on-menu-collapse": boolean;
    "home-header-get-user": void;
    "paper-answer-percentage": number;
    "grading-paper-table-close": void;
    "grading-paper-total-score": number;
};

//调用mitt，得到mitter ，mitter可以绑定事件 触发事件 解绑事件
export const emitter: Emitter<Events> = mitt<Events>();
